package LinkHashSet_;

import java.util.*;

/*
 *@Student 张策
 */
public class Main {
    public static void main(String[] args) {
        TreeSet<String> objects = new TreeSet<>(new Comparator<Object>() {
            @Override
            public int compare(Object o1, Object o2) {
                return ((String)o1).compareTo((String)o2);
            }
        });

    }
    public static void main2(String[] args) {
        HashMap<Car,Integer> map1 = new HashMap<>();
        for (int i = 0; i < 100; i++) {
            map1.put(new Car(i),6);
        }
//        map1.put("55",2);
//        map1.put("张策",1);
//        map1.put("李四",2);
//        for (Map.Entry<String,Integer> x:map1.entrySet()){
//            System.out.println(x);
//        }
    }
    public static void main1(String[] args) {
        LinkedHashSet<Car> cars = new LinkedHashSet<>();
        cars.add(new Car("奥迪",10000));
        cars.add(new Car("奔驰",1500));
        cars.add(new Car("或奥",19000));
        cars.add(new Car("奥迪",10000));
    }
}
class Car{
    private String name;
    private int price;

    public Car(int price) {
        this.price = price;
    }

    public Car(String name, int price) {
        this.name = name;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "Car{" +
                "name='" + name + '\'' +
                ", price=" + price +
                '}';
    }

}
